<% if @groups.length == 0 then %>
  <p>Não existe nenhum grupo registrado.</p>
<% else %>
  <table border="1">
  <thead>
      <tr>
        <td>Nome</td>
        <td>Regras</td>
        <td>&nbsp;</td>
      </tr>
  </thead>
  <tbody>
      <% for group in @groups %>
      <tr onmouseover="this.style.background='#DFDFFF'" onmouseout="this.style.background=''">
        <td><%=group[:name]%></td>
        <td>
            <div class="list_values">
                <% for role in group.roles%>
                  <%=role[:name]%><br/>
                <% end %>
            </div>
        </td>
        <td style="width:55px">
              <%=link_to_remote( 
                        image_tag("/images/icons/alter.gif", :title => "alterar", :border => "0" ), 
                        :url => { :action => "group_form", :id => group[:id], :act => "group_alter" }, 
                        :loading => "TrackSuite.ajax.loadding('group_list_action_#{group[:id]}');",
                        :loaded => "TrackSuite.ajax.loaded.clear('group_list_action_#{group[:id]}');"
              )%>
              <%=link_to_remote( 
                        image_tag("/images/icons/remove.gif", :title => "remover", :border => "0" ), 
                        :url => { :action => "group_remove", :id => group[:id] }, 
                        :loading => "TrackSuite.ajax.loadding('group_list_action_#{group[:id]}');",
                        :loaded => "TrackSuite.ajax.loaded.clear('group_list_action_#{group[:id]}');",
                        :confirm => "Atenção, deseja remover o grupo #{group[:name]}."
              )%>
              <span id="group_list_action_<%=group[:id]%>">&nbsp;</span>
          </td>
      </tr>
      <% end %>
  </tbody>
  <tfoot>
      <tr>
          <td colspan="4" align="right">&nbsp;<%= will_paginate @groups, {:ajax => ajax} %></td>
      </tr>
  </tfoot>
  </table>
<% end %>